<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function doPage(pageNo) {
            document.forms[0].pageNum.value = pageNo;
            document.forms[0].submit();
        }
    </script>
</head>
<body>
<form th:action="@{/users}">
    <input type="hidden" name="pageNum">
    昵称：<input name="realName" th:value="${user.realName}"><br>
    account：<input name="account" th:value="${user.account}">
    <input type="submit" value="查询">
<a th:href="@{/users/add}">添加</a>
<table>
    <tr>
        <td>ID</td>
        <td>ACCOUNT</td>
        <td>REALNAME</td>
        <td>SEX</td>
        <td>BIRTHDAY</td>
        <td>OPR</td>
    </tr>
    <tr th:each="item : ${page.content}">
        <td th:text="${item.id}">ID</td>
        <td th:text="${item.account}">ACCOUNT</td>
        <td th:text="${item.realName}">REALNAME</td>
        <td th:text="${item.sex}">SEX</td>
        <td th:text="${item.birthday}">BIRTHDAY</td>
        <td>
            <a th:href="@{/users/del/}+${item.id}">删除</a>
            <a th:href="@{/users/get/}+${item.id}">修改</a>
        </td>
    </tr>
</table>
    <div>
        当前<span th:text="${page.number + 1}">1</span>页，共<span th:text="${page.totalElements}">10</span>条，共<span th:text="${page.totalPages}">5</span>页，每页<span th:text="${page.size}">2</span>条
    </div>
    <div>
        <span th:if="${page.number <= 0}">上页</span>
        <a th:if="${page.number > 0}" href="javascript:void(0)" th:onclick="doPage([[${page.number}]])">上页</a>
        <a th:if="${page.number + 1 < page.totalPages}" href="javascript:void(0)" th:onclick="doPage([[${page.number + 2}]])">下页</a>
        <span th:if="${page.number + 1 >= page.totalPages}">下页</span>
    </div>
</form>
</body>
</html>